var fs = require('fs')

// json文件目录
var nsFilePath = './statistic/02_family/c/ns.json'
var pointFilePath = './statistic/02_family/c/point.json'
var processFilePath = './statistic/02_family/c/process.json'
var img1FilePath = './statistic/02_family/c/img_1.json'
var img2FilePath = './statistic/02_family/c/img_2.json'
var img3FilePath = './statistic/02_family/c/img_3.json'

const loadData = function(url) {
    var temp = fs.readFileSync(url, 'utf8')
    var temps = JSON.parse(temp)
    return temps
}



var nss = {
    data:loadData(nsFilePath)
}

var points = {
    data:loadData(pointFilePath)
}

var processs = {
    data:loadData(processFilePath)
}


var img1 = {
    data:loadData(img1FilePath)
}
var img2 = {
    data:loadData(img2FilePath)
}
var img3 = {
    data:loadData(img3FilePath)
}



// 模块导出
// 定义相关函数

var res = {}


res.nsAll = function() {
    var contents = nss.data
    return contents
}
res.pointAll = function() {
    var contents = points.data
    return contents
}
res.processAll = function() {
    var contents = processs.data
    return contents
}
res.img1All = function() {
    var contents = img1.data
    return contents
}
res.img2All = function() {
    var contents = img2.data
    return contents
}
res.img3All = function() {
    var contents = img3.data
    return contents
}





//导出一个对象，可直接引用
module.exports = res
